/**
 * 
 */
package com.beta.restapi.internal.mapper;

import java.util.ArrayList;
import java.util.List;
import java.util.function.Function;

/**
 * @author vector
 *
 */
public class BeanMapper {
	
	private BeanMapper() {
		
	}
	
	public static <S, D> D map(S s, Function<S, D> converter) {
		return converter.apply(s);
	}
	
	public static <S, D> List<D> mapAsList(Iterable<S> si, Function<S, D> converter) {
		List<D> list = new ArrayList<>();
		si.forEach(item -> {
			list.add(converter.apply(item));
		});
		return list;
	}

}
